package com.linkhouse.interfaces;

import com.linkhouse.domain.po.TbNewRoom;
import com.linkhouse.domain.po.TbNewSmallArea;
import com.linkhouse.domain.po.TbOldRoom;
import com.linkhouse.mapper.TbNewRoomESMapper;
import com.linkhouse.mapper.TbNewSmallAreaMapper;
import com.linkhouse.mapper.TbOldRoomESMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.SearchHit;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("newSmallArea")
@RefreshScope //开启自动刷新配置
public class TbNewSmallAreaInterfaces{
    @Autowired
    private TbNewSmallAreaMapper      tbNewSmallAreaMapper;
    @Autowired
    private ElasticsearchRestTemplate elasticsearchRestTemplate;
    @Autowired
    private TbNewRoomESMapper         tbNewRoomESMapper;
    //新房源小区
    @GetMapping
    public List<TbNewSmallArea> query(Long smallAreaId){
        smallAreaId = 654L;
        List<SearchHit<TbNewRoom>> byRoomAddr = tbNewRoomESMapper.findBySmallAreaId(smallAreaId);
        byRoomAddr.forEach(System.err::println);
        return tbNewSmallAreaMapper.selectList(null);
    }

}
